package pl.cvplus.entity;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
public class CpUserRolesPK implements Serializable {
    private Integer roleFk;

    @Id
    @Column(name = "role_fk", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    public Integer getRoleFk() {
        return roleFk;
    }

    public void setRoleFk(Integer roleFk) {
        this.roleFk = roleFk;
    }

    private Integer userFk;

    @Id
    @Column(name = "user_fk", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    public Integer getUserFk() {
        return userFk;
    }

    public void setUserFk(Integer userFk) {
        this.userFk = userFk;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpUserRolesPK that = (CpUserRolesPK) o;

        if (roleFk != null ? !roleFk.equals(that.roleFk) : that.roleFk != null) return false;
        if (userFk != null ? !userFk.equals(that.userFk) : that.userFk != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roleFk != null ? roleFk.hashCode() : 0;
        result = 31 * result + (userFk != null ? userFk.hashCode() : 0);
        return result;
    }
}
